//导入vue
import Vue from 'vue';
import VueRouter from 'vue-router';

import Main from "@/views/Main";
import Login from "@/views/Login";
import UserProfile from "@/views/user/Profile";
import UserList from "@/views/user/List";
import NotFound from "@/views/NotFound";

Vue.use(VueRouter);

export default new VueRouter({
    mode: 'history',
    routes: [
        {
            //登录页
            path: '/main/:username',
            name: 'main',
            props: true,
            component: Main,
            children: [
                {path: '/user/profile', name: 'UserProfile', component: UserProfile, props: true},
                {path: '/user/list', component: UserList}
            ]
        },
        {
            path: '/goHome',
            redirect: '/main'
        },
        //首页
        {
            path: '/login',
            name: 'login',
            component: Login
        },
        {
            path: '*',
            component: NotFound
        }
    ]
})

